22:22
function startTime() {
    var date=new Date();
    var h=date.getHours();
    var suffex = '';
    if(localStorage['ngui_timeformat'] == '12h') {
        suffex = (h >= 12)? 'pm' : 'am';
        h = (h > 12)? h -12 : h;
        h = (h == '00')? 12 : h;
    }
    var m=date.getMinutes();
    var s=date.getSeconds();
    m=checkTime(m);
    s=checkTime(s);
    
    if(localStorage['ngui_showdate'] == 'show') {
        $('#dateDisplay').html($.datepicker.formatDate('d M yy', date));
    }
    else $('#dateDisplay').html('');
        
    
    document.getElementById('clockDisplay').innerHTML=h+":"+m+''+suffex+'';
    t=setTimeout(function(){startTime()},5000);
}
function startWeather() {
    if(localStorage['loc'] != null && localStorage['loc'] != "") {
        $.simpleWeather({
            location:localStorage['loc'],
            unit: localStorage['unit'],
            success: function(weather) {
                $("#weatherDisplayTemp").html(weather.temp+'°'+weather.units.temp);
                $("#weatherDisplayCond").html(weather.city+' '+weather.currently);
            },
            error: function(error) {$("#weatherDisplayTemp").html('');$("#weatherDisplayCond").html('')}
        });
    }
    t=setTimeout(function(){startWeather()},60000);
}
function checkTime(i){if (i<10){i="0" + i;}return i;}

$(document).ready(
    function() {
        if(localStorage['unit'] == null || localStorage['unit'] == "") {
            localStorage['unit'] = 'c';
        }
        startTime();
        startWeather();
        checkColourSchemeText(true);
    }
);